/*
 * gameobjectviewfactory.cpp
 *
 *  Created on: Nov 29, 2009
 *      Author: magnus
 */

#include "gameobjectviewfactory.h"
#include "gameobjectreader.h"
#include "gameobjectview.h"

namespace spacedefender {
GameObjectViewFactory GameObjectViewFactory::_instance;


GameObjectViewFactory::GameObjectViewFactory()
{
}

GameObjectViewFactory::~GameObjectViewFactory()
{
}

bool GameObjectViewFactory::Init(const GameObjectReader* gor)
{

	_objects["spaceship"] = gor->GetGameObjectView("spaceship");

	return true;
}


GameObjectView* GameObjectViewFactory::CreateView(const std::string& id) const
{
	std::map<const std::string, const GameObjectView*>::const_iterator iter = _objects.find(id);
	return (_objects.end() !=  iter ) ? new GameObjectView( iter->second->GetMesh()) : NULL ;

}




}
